home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 111 / PC Guia 111.iso / Software / Utils / NetObjects Fusion 7.0 / NOF7Trial.exe / data1.cab / Fsi_-_English / CheckUpdate / CheckUpdate.js < prev   
Text File  |  2002-06-12  |  5KB  |  175 lines

  1. function checkForUpdate(title)
  2. {
  3.     app = new ActiveXObject('FSI.FSIApplication');
  4.     app2 = new ActiveXObject('FSI.FSIApplication2');
  5.     app.OpenStatusDialog(title, '\nConnecting...');
  6.     versionString = app.GetRegistryString(true, 'Version');
  7.     versionString = versionString.split('.');
  8.     version = versionString[0];
  9.     versionInfo = app.GetRegistryString(true, 'VersionInfo');
  10.  
  11.     var s = app.HttpRequest('http://www.netobjects.com/update/AutoUpdater.cgi', '', 'Application=Fusion&Version=' + version + '&VersionInfo=' + versionInfo, false, false, true);        
  12.     if (app.CloseStatusDialog(0))
  13.         return false;
  14.  
  15.     if (s.length == 0) 
  16.         return false;
  17.  
  18.     register(app);    // We are online, check whether there is a need to register.
  19.  
  20.     args = s.split(',');
  21.     if (args.length != 4)
  22.         return false;
  23.  
  24.     var now = new Date();
  25.     var ms = now.getTime();
  26.     app2.DataLastChecked = Math.round(ms/1000);
  27.  
  28.     app.LatestFusionUpdate = args[0] - 0;
  29.     app.LatestUpdater = args[1] - 0;
  30.  
  31.     serviceUpdate = args[2] - 0;
  32.     hostingUpdate = args[3] - 0;
  33.     if (serviceUpdate > app.ServiceUpdate)
  34.         app.ServiceUpdate = serviceUpdate;
  35.     if (hostingUpdate > app.HostingUpdate)
  36.         app.HostingUpdate = hostingUpdate;
  37.  
  38.     if (args.length >= 6)
  39.     {
  40.         serviceViewUpdate = args[4] - 0;
  41.         newsUpdate = args[5] - 0;
  42.         if (serviceViewUpdate > app.ServiceViewUpdate)
  43.             app.ServiceViewUpdate = serviceViewUpdate;
  44.         if (newsUpdate > app.NewsUpdate)
  45.             app.NewsUpdate = newsUpdate;
  46.     }
  47.  
  48.     return true;
  49. }
  50.  
  51. function checkOnline(title)
  52. {
  53.     for (;;)
  54.     {
  55.         if (checkForUpdate(title))
  56.             return true;
  57.             
  58.         if (app.Cancel)
  59.             return false;
  60.  
  61.         if (window.showModalDialog("../InitFusion/Offline.html", 0,
  62.                 "status:no;help:no;border:thin;dialogWidth:220px;dialogHeight:110px;center:yes;scroll:no;") != 1)
  63.             return false;
  64.     }
  65. }
  66.  
  67. function checkOnline2(title)
  68. {
  69.     for (;;)
  70.     {
  71.         if (checkForUpdate(title))
  72.             return true;
  73.  
  74.         if (app.Cancel)
  75.             return false;
  76.  
  77.         if (window.showModalDialog("../FSI/InitFusion/Offline.html", 0,
  78.                 "status:no;help:no;border:thin;dialogWidth:220px;dialogHeight:110px;center:yes;scroll:no;") != 1)
  79.             return false;
  80.     }
  81. }
  82.  
  83. function register(app)
  84. {
  85.     serialNumber = app.GetRegistryString(true, 'SerialNumber');
  86.     if (!serialNumber.length)
  87.         return;
  88.  
  89.     var firstname = app.GetSystemVar('nof_reg_firstname');
  90.     
  91.     if (!firstname.length)
  92.         return;
  93.         
  94.     var lastname = app.GetSystemVar('nof_reg_lastname');
  95.     var businessname = app.GetSystemVar('nof_reg_businessname');
  96.     var email = app.GetSystemVar('nof_reg_email');
  97.  
  98.     if (email && email.length)
  99.     {
  100.         netoInfo = (app.GetSystemVar('nof_up_netoinfo') == 'True') ? 'Yes' : 'No';
  101.         partnerInfo = (app.GetSystemVar('nof_up_partnerinfo') == 'True') ? 'Yes' : 'No';
  102.  
  103.         var serialnumber = app.GetRegistryString(true, 'SerialNumber');
  104.         var versioninfo = app.GetRegistryString(true, 'VersionInfo');
  105.         var address1 = app.GetSystemVar('nof_up_address1');
  106.         var address2 = app.GetSystemVar('nof_up_address2');
  107.         var city = app.GetSystemVar('nof_up_city');
  108.         var state = app.GetSystemVar('nof_up_state');
  109.         var zip = app.GetSystemVar('nof_up_zip');
  110.         var country = app.GetSystemVar('nof_up_country');
  111.         var phone = app.GetSystemVar('nof_up_phone');
  112.         var fax = app.GetSystemVar('nof_up_fax');
  113.         var website = app.GetSystemVar('nof_up_url');
  114.  
  115.          if (firstname.length > 40)
  116.             firstname = firstname.substr(0, 40);
  117.          if (lastname.length > 40)
  118.             lastname = lastname.substr(0, 40);
  119.          if (email.length > 50)
  120.             email = email.substr(0, 50);
  121.          if (businessname.length > 40)
  122.             businessname = businessname.substr(0, 40);
  123.          if (address1.length > 50)
  124.             address1 = address1.substr(0, 50);
  125.          if (address2.length > 50)
  126.             address2 = address2.substr(0, 50);
  127.          if (city.length > 20)
  128.             city = city.substr(0, 20);
  129.          if (state.length > 20)
  130.             state = state.substr(0, 20);
  131.          if (zip.length > 20)
  132.             zip = zip.substr(0, 20);
  133.          if (country.length > 40)
  134.             country = country.substr(0, 40);
  135.          if (phone.length > 30)
  136.             phone = phone.substr(0, 30);
  137.          if (fax.length > 30)
  138.             fax = fax.substr(0, 30);
  139.          if (website.length > 50)
  140.             website = website.substr(0, 50);
  141.  
  142.          args = 'id=' + email;
  143.         args += '&newid=' + email;
  144.         args += '&serialnumber=' + serialnumber;
  145.         args += '&versioninfo=' + versioninfo;
  146.         args += '&firstname=' + firstname;
  147.         args += '&lastname=' + lastname;
  148.         args += '&email=' + email;
  149.         args += '&companyname=' + businessname;
  150.         args += '&address1=' + address1;
  151.         args += '&address2=' + address2;
  152.         args += '&city=' + city;
  153.         args += '&state=' + state;
  154.         args += '&zip=' + zip;
  155.         args += '&country=' + country;
  156.         args += '&phone=' + phone;
  157.         args += '&fax=' + fax;
  158.         args += '&website=' + website;
  159.         args += '&netoinfo=' + netoInfo;
  160.         args += '&partnerinfo=' + partnerInfo;
  161.  
  162.         var s = app.HttpRequest('http://webdb2.netobjects.com/register/reg.cfm', '', args, false, true, true);
  163.  
  164.         if (s.search('status=success') != -1)
  165.         {
  166.             app.SetSystemVar('nof_reg_firstname', '');
  167.             app.SetSystemVar('nof_reg_lastname', '');
  168.             app.SetSystemVar('nof_reg_businessname', '');
  169.             app.SetSystemVar('nof_reg_email', '');
  170.         }
  171.     }
  172. }
  173.  
  174.  
  175.